<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragments :: head"></head>
<body>
	<div class="container">
		<div th:replace="fragments :: navbar"></div>
		<h4 class="float-left mt-2">生成授权证书</h4>
		<div class="clearfix"></div>
		<form id="licenseForm" class="mt-4" th:action="@{/licenses}" th:object="${licenseCreateBean}" action="#" method="post">
			<div th:if="${#fields.hasErrors('*')}" class="alert alert-danger" role="alert">
				<p th:each="error : ${#fields.errors('*')}" class="m-0" th:text="${error}">Validation error</p>
			</div>
			<div th:if="${licPath}" class="alert alert-primary" role="alert">
				<a class="btn  btn-link btn-sm" th:href="@{'/licenses/download/' + ${licPath}}">证书制作完成，请点击下载</a>
			</div>
			<div class="form-group row">
				<label for="subject" class="col-sm-2 col-form-label">主题</label> 
				<div class="col-sm-6">
					<input type="text" th:field="*{subject}" th:class="${'form-control' + (#fields.hasErrors('subject') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="issuedTime" class="col-sm-2 col-form-label">生效日期</label>
				<div class="col-sm-6">
					<input type="date" th:field="*{issuedTime}" th:class="${'form-control' + (#fields.hasErrors('issuedTime') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="days" class="col-sm-2 col-form-label">有效期(天)</label> 
				<div class="col-sm-6">
					<input type="text" th:field="*{days}" th:class="${'form-control' + (#fields.hasErrors('days') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="info" class="col-sm-2 col-form-label">附加信息</label> 
				<div class="col-sm-6">
					<input type="text" th:field="*{info}" th:class="${'form-control' + (#fields.hasErrors('info') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="storePath" class="col-sm-2 col-form-label">秘钥库位置</label> 
				<div class="col-sm-6">
					<input type="text" th:field="*{storePath}" th:class="${'form-control' + (#fields.hasErrors('storePath') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="storePass" class="col-sm-2 col-form-label">秘钥库密码</label> 
				<div class="col-sm-6">
					<input type="password" th:field="*{storePass}" th:class="${'form-control' + (#fields.hasErrors('storePass') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="alias" class="col-sm-2 col-form-label">秘钥别名</label> 
				<div class="col-sm-6">
					<input type="text" th:field="*{alias}" th:class="${'form-control' + (#fields.hasErrors('alias') ? ' is-invalid' : '')}">
				</div>
			</div>
			<div class="form-group row">
				<label for="keyPass" class="col-sm-2 col-form-label">密钥密码</label> 
				<div class="col-sm-6">
					<input type="password" th:field="*{keyPass}" th:class="${'form-control' + (#fields.hasErrors('keyPass') ? ' is-invalid' : '')}">
				</div>
			</div>
			<button type="submit" class="btn btn-primary">开始</button>
		</form>
	</div>
</body>
</html>
